using SinceUnity.LobbyNetwork;
using System.Collections;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class LoadingView : MonoBehaviour
{
	public Slider progressBar;
	void Start()
	{
		//StartCoroutine(LoadNextScene());
	}

	private IEnumerator LoadNextScene()
	{
		// 启动异步加载主场景
		var handle = Addressables.LoadSceneAsync("sc_NetBattle");
		while (!handle.IsDone)
		{
			progressBar.value = handle.PercentComplete;
			yield return null;
		}
		
		yield return null;

		handle.Result.ActivateAsync();
	}

	private void OnGUI()
	{
		if(GUI.Button(new Rect(100,100,300,50), "PVE"))
		{
			Lobby.JoinWithNpcServer(1000,2000,false);
		}
	}
}
